<?
if (!defined('MODULE_FILE')){
die ("cant access file directly!");
}
	$mid1 = $_GET['mid'];
	$user_id = $_GET['uid'];
	$level_id1 = $_GET['level_id'];
	$mid2 = $_GET['mid1'];
	$link_id = $_GET['linkid'];
	$smid = $_GET['smid'];
		
require_once 'class/EmpRegister.php';
require_once 'class/NewModule.php';
//For User name	
	$userobj = new EmpRegister();
	$Usresult = $userobj->get1($user_id);
	$name = $Usresult[0]['Name'];		
	$att = new NewModule();
?>
<? 
if(isset($_POST['Submit'])) 
		{ 	
			$level_id3 = $_POST['level_id'];
			if($link_id >= 1)
			{
				$att->UpdateLink();
				print "<script>";
				print "self.location='modules.php?file=list_acl_docs&uid=$user_id&mid=$mid1&smid=$smid'";		
				print "</script>";
			}
			else
			{
			   $att->AddLink();
				print "<script>";
				print "self.location='modules.php?file=list_acl_docs&uid=$user_id&mid=$mid1&smid=$smid'";		
				print "</script>";
			}
		
		}
				
	if(isset($_GET['mid1'])) 
    { 	
	$row1 = $att->get($_GET['mid1']);	
	} 
?>	<br><br>				
<div class="col-lg-6">
<div class="panel panel-info">
<div class="panel-heading"><i class="fa fa-bell fa-fw"></i>Access Control For( <span style="font-size: 16px; color: #A52A2A;"><b><? echo $name;?></b></span> )</div>
<div class="panel-body">


<form action="" method="POST">
<table style="font-size: 16px; color: #666666;  width: 700px;" border="0" cellspacing="3" cellpadding="0" >
<tr>
	<td >Parent:</td>
	<td>
		<?   $i=3;
		     $p_id = $row1[0]['parent'];
			 $row14 = $att->get($p_id);	
				if($p_id==0)
				{
				echo $row1[0]['title'];
				}
				else{
			    echo $row14[0]['title'];
			    } ?>
	</td>
</tr>
<tr><td colspan="2" height="10px"></td></tr>
<tr>
<td valign="top">File Name :</td>
<td> <?  echo $row1[0]['title']; ?></td>
</tr>
<tr><td colspan="2" height="10px"></td></tr>
<tr> 
<td valign="top">File Path:</td>
<td><? echo $row1[0]['path']?></td>
</tr>
<tr><td colspan="2" height="10px"></td></tr>
<tr>
<td>User:</td>
<td>			 
<? echo $Usresult[0]['Name']; ?>&nbsp;(<? echo $Usresult[0]['Login']; ?>)
</td>
</tr>
<tr><td colspan="2" height="10px"></td></tr>
<tr> 
<td valign="top">Access:</td>
<td> 
	<?  
	 $row12 = $att->getlink($user_id,$mid2);	
	 $level_id2 = $row12[0]['level_id'];
	 ?>
	<select name="level_id" id="level_id">
	<option value="0"  <? if($row12[0]['level_id2']=='0' or $_GET['level_id']=="0"){echo "selected";} ?>>No</option>
	<option value="1"  <? if($row12[0]['level_id2']=='1' or $_GET['level_id']=="1"){echo "selected";} ?>>Write</option>		
    </select>  
</td>
</tr>
<tr><td colspan="2" height="10px"></td></tr>
<tr>
<td></td>
<td>
<input type="hidden" name="mid" id="mid" value="<?php echo $_GET['mid'];?>"/>
<input type="submit" name="Submit" value="Submit">
</td>
</tr>
</table>
</form>
</div>
</div>
</div>